{% macro render_comment(comment, level=0) %}
<div class="comment card {% if level > 0 %}reply{% endif %}" style="margin-left: {{ level * 20 }}px;" id="c-{{ comment.id }}">
    <div class="comment-header">
        <span class="comment-author">{{ comment.author.username }}</span>
        <span class="comment-time">{{ comment.timestamp.strftime('%Y-%m-%d %H:%M') }}</span>
    </div>
    <div class="comment-content">
        {{ comment.content }}
    </div>
    <div class="comment-actions">
        <button class="btn btn-sm like-comment" data-comment-id="{{ comment.id }}">
            <i class="fas fa-thumbs-up"></i>
            <span class="like-count">{{ comment.likes_count }}</span>
        </button>
        <button class="btn btn-sm reply-btn" data-comment-id="{{ comment.id }}">
            <i class="fas fa-reply"></i> 回复
        </button>
    </div>
    <div class="reply-form" id="reply-form-{{ comment.id }}" style="display: none;">
        <textarea class="form-control reply-input" placeholder="写下你的回复..."></textarea>
        <button class="btn btn-sm submit-reply" data-comment-id="{{ comment.id }}">发送回复</button>
    </div>
    {% if comment.replies %}
        <div class="replies">
            {% for reply in comment.replies %}
                {{ render_comment(reply, level + 1) }}
            {% endfor %}
        </div>
    {% endif %}
</div>
{% endmacro %} 